package cn.gene.timeyan.ams.webapi.controller;

import cn.gene.timeyan.ams.service.IAdminService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.gene.timeyan.common.restful.JsonResult;

import java.util.Map;

/**
 * 管理员   前端控制器*
 *
 * @author LWG
 * @date 2022/7/21 16:47
 * @since 1.0.0@gene.cn
 */
@RestController
@RequestMapping("/ams/admin")
@Api(tags = "后台用户模块")
@Slf4j
public class AdminController {
//    @DubboReference
    @Autowired
    IAdminService adminService;

    /**
     * 获取每个月新增的人数，返回给前端
     * 还有总人数
     * @return
     */
    @ApiOperation("获取每个月新增的人数")
    @ApiOperationSupport(order = 0)
    @GetMapping("/members")
    public JsonResult<Map<String,Object>> members() {
        JsonResult<Map<String,Object>> result = new JsonResult<>();

        Map<String,Object> map = adminService.members();

        result.ok(map);

        return result;

    }
}
